<!--
/*
 * Copyright 2012 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * Author: Marc Cohen
 *
 */
-->

<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
  <!-- HTML 5 Boilerplate -->
  <link rel="stylesheet" href="/css/base_style.css?v=2">
  <!-- app specific styles -->
  <link rel="stylesheet" href="/css/style.css">
  <link rel="shortcut icon" href="/images/favicon.ico" />

  <title>Try the Google Prediction API</title>
  <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
  <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js"></script>
  <script type="text/javascript" src="https://www.google.com/jsapi"></script>
  <script type="text/javascript" src="/js/predict.js"></script>
</head>
<body>
<div>
  <header>      
    <div id="logo"></div>
    <div id="app_title">Try the <a id="api_link" href="https://developers.google.com/prediction/">Google Prediction API</a></div>
  </header>
  <table>
    <tr><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr><td><div class="label">Select a model:</div></td><td colspan="2">
      <span><select id="model_id" onchange="change_model(this)">
        {% for key, value in models.items %}
          {% if not value.user_list or user in value.user_list %}
            {% if key == selected_model %}
              <option value="{{key}}" selected="selected">{{key}}</option>
            {% else %}
              <option value="{{key}}">{{key}}</option>
            {% endif %}
          {% endif %}
        {% endfor %}
      </select></span>
      {% for key, value in models.items %}
        {% if key == selected_model %}
          <span class="help">{{value.description|safe}}</span></tr>
          {% for field in value.fields %}
            <tr><td><div class="label">{{field.label}}:</div></td><td>
            {% if field.rows == "1" %}
              <input onkeydown="return keydown(event)" type="text" size="{{field.cols}}" id="{{field.label}}" class="input"></input>
            {% else %}
              <textarea cols="{{field.cols}}" rows="{{field.rows}}" id="{{field.label}}" class="input"></textarea>
            {% endif %}
            </td><td><div class="help">{{field.help}}</div></td></tr>
          {% endfor %}
        {% endif %}
      {% endfor %}
    <tr><td></td><td>
      <a class="atd-button atd-search-button" style="margin-left: 0px; margin-top: 10px;" onclick="predict()">Predict</a>        
      </td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr><td><div class="label">Results:</div></td><td><b><div id="prediction_result"></div></b><a href='' id="switch_chart_link"></a></td></tr>
    <tr><td>&nbsp;</td><td>
      <div id="results_chart"></div>
    </td></tr>
  </table>
</div>
</body>
